import org.springframework.web.client.RestTemplate;

public class Main {
    public static void main(String[] args) {
        // 假设不同的证书配置
        String keyStorePath1 = "path/to/keystore1.jks";
        String keyStorePassword1 = "password1";
        String keyStorePath2 = "path/to/keystore2.jks";
        String keyStorePassword2 = "password2";

        // 创建不同配置的 RestTemplate 实例
        RestTemplate restTemplate1 = RestTemplateFactory.createRestTemplate(keyStorePath1, keyStorePassword1);
        RestTemplate restTemplate2 = RestTemplateFactory.createRestTemplate(keyStorePath2, keyStorePassword2);

        // 调用外部接口示例
        String response1 = restTemplate1.getForObject("https://example.com/api1", String.class);
        String response2 = restTemplate2.getForObject("https://example.com/api2", String.class);

        System.out.println("Response from API 1: " + response1);
        System.out.println("Response from API 2: " + response2);
    }
}    